1. Field of the Invention
The invention relates to an encoding method and an encoding apparatus of a moving picture and, more particularly, to an encoding method and an encoding apparatus for encoding each of a plurality of frames constructing moving picture data and outputting it.
2. Related Background Arts
Services for transmitting moving pictures like a TV telephone, a portable information terminal, video-on-demand, and a digital TV broadcasting system will be widely spread.
In case of transmitting a moving picture, generally, the image is encoded in accordance with a transmission band of a transmission path. To encode the moving picture, a system such as MPEG1 or MPEG2 which is specified by the ISO or a system such as H.262, H.263, or the like which is specified by the ITU-T is used.
Usually, in case of compression encoding a moving picture, a bit rate of image data to be encoded is controlled (rate control). One of a typical method as a rate control method is a method of adjusting a frame rate in accordance with a bit rate of each frame. There is also a typical method whereby when the used bits in a certain frame is large, a bit rate is suppressed by widening a quantization size of next several frames. Further, a technique for varying an encoding frame rate in accordance with a situation is known. Such a technique has been disclosed in, for example, JP-A-9-130787.
When the encoded moving picture is transmitted, a method whereby moving picture data constructed by a plurality of continuous frames is packetized, encoded every packet, and transmitted is ordinarily used. At this time, either a method whereby codes which are generated since the whole one frame constructing the moving picture has been encoded are stored into one packet or a method whereby codes which are generated since a part of the frame has been encoded are stored is used.
There is a case where the packets do not reach a decoding apparatus side due to the loss of the packets on the transmission path or the like. In such a case, the lost portion cannot be decoded in the decoding apparatus. At this time, if the codes of one frame have been stored in the packet, the whole frame cannot be decoded. To prevent it, a method whereby the image of one frame is divided into a plurality of areas and the divided image areas are encoded and transmitted as packets (packet division) is generally used.
The packets obtained by encoding the divided image areas can be decoded without referring to other packet encoded information. Therefore, the encoded image areas can be independently decoded.
A code transmission control such that if it is determined that it is difficult to transmit the packet while a transmission rate is monitored by using such a packet dividing method, a transmitting apparatus does not transmit the packet purposely is also performed.
There is a possibility, however, that a picture quality and the frame rate become unstable and a reconstructed image becomes unnatural.
For example, according to the method of adjusting the frame rate, there is a situation such that in spite of the fact that there is a surplus capacity in a buffer on the encoding side, data is not transmitted at a certain time, thus a filter may occur on a display picture plane. According to the method of adjusting the quantization size, there is a problem such that it is difficult to accurately predict the bit rate, the picture quality of the reconstructed image becomes unstable, or a delay is caused.
In case of packetization, according to the method for controlling the transmission and non-transmission of the packet in accordance with a surplus degree of the transmission rate, a reference image which is used for encoding/decoding of the next frame in the encoding apparatus differs from that in the decoding apparatus, so that there is a problem such that it results in deterioration of the picture quality.
When the above-described techniques and subjects are summarized, in a conventional technique, an amount of data to be transmitted to the decoding apparatus through the transmission path needs to be controlled because of a limitation by the transmission band of the transmission path. More accurately, it is necessary to control a bit rate as an amount of bits of the frame which was encoded. As a control method, for example, a method by a frame dropout such that frames are thinned out, a method of adjusting the quantization width at the time of encoding the frame, or a method of forming packets including the frames and adjusting transmission timing of each packet has been well known hitherto.
According to the conventional bit rate control method, however, the transmission band of the transmission path cannot be effectively used and it is difficult to optimally use an effective band permitted for data communication in the transmission band corresponding to the bit rate of the frame.
It is an object of the invention to provide moving picture encoding method and apparatus for encoding each frame constructing a moving picture to be transmitted so as to suppress a deterioration in quality of the moving picture which is decoded by a decoding apparatus by effectively making the most of a transmission band of a transmission path under a limitation of the transmission band.
The moving picture encoding apparatus according to the invention fundamentally calculates a prediction code amount with respect to each frame constructing a moving picture. For example, a target code amount upon encoding of the current frame is calculated on the basis of a prescribed target bit rate or code amount information regarding the preceding frame. An area to be encoded in the current frame is determined on the basis of the target code amount and the prediction code amount.
When the area to be encoded is determined, whether the encoding of the current frame is performed or not can be first decided.
When it is determined that the encoding of the current frame is performed, whether the whole current frame is encoded or a partial area of the current frame is encoded can be determined on the basis of the prediction code amount. According to the encoding of the partial area, it is useful to interpolate data regarding an area which is not encoded in the current frame. When the code amount regarding the current frame exceeds a predetermined threshold value which gives the target code amount, the encoding of the current frame can be stopped.
According to the invention, there is provided a moving picture encoding apparatus for encoding moving picture data showing a moving picture every frame constructing the moving picture data and sequentially transmitting the encoded frame through a transmission path, comprising: an encoding circuit which sequentially encodes the moving picture data every frame; a memory circuit which stores a data amount after the encoding regarding a first frame encoded by the encoding circuit; a predicting circuit which predicts a data amount after the encoding regarding a second frame which will be obtained when the second frame subsequent to the first frame is encoded; a calculating circuit which calculates a target data amount which the data amount after the encoding of the second frame should not exceed at the time when the encoding circuit encodes the second frame by using a transmission band specified by the transmission path and the data amount which relates to the frame after the encoding of the first frame and was stored in the memory circuit; and a determining circuit which determines an area to be encoded in the second frame by using the data amount after the encoding regarding the second frame which was predicted by the predicting circuit and the target data amount regarding the second frame which was calculated by the calculating circuit.
In the moving picture encoding apparatus according to the invention, the determining circuit determines the area to be encoded in the second frame by using: the data amount after the encoding of the second frame which was predicted by the predicting circuit; and the target data amount for the second frame which was calculated by the calculating circuit on the basis of the transmission band of the transmission path and the data amount after the encoding of the first frame which was encoded by the encoding circuit. Thus, the encoding circuit can perform the encoding in consideration of: the predicted data amount after the encoding of the second frame of which internal factors for the second frame as a second frame itself are taken into consideration; and the target data amount for the second frame of which external factors for the second frame as transmission band of the transmission path and the data amount after the encoding of the first frame are taken into consideration. Therefore, even under the limitation of the transmission band of the transmission path or even if the available transmission band permitted for image communication changes, the transmission band can be made the most of in accordance with such a change, so that the deterioration of a quality of the moving picture after the decoding is reduced as compared with the conventional one.
According to the first aspect of the invention, there is provided a moving picture encoding apparatus for encoding moving picture data every frame constructing the moving picture data, comprising:
a packet encoding unit which encodes each frame constructing a moving picture and outputs code amount information regarding the frame;
a target code amount setting unit which receives the frame of the moving picture, calculates a prediction code amount regarding the frame on the basis of it, receives a target bit rate and the code amount information regarding the frame, and calculates a target code amount regarding the frame on the basis of them; and
an encoding discriminating unit which determines whether the encoding of the frame is executed or not on the basis of the target code amount and the prediction code amount.
According to the second aspect of the invention, there is provided a moving picture encoding apparatus for encoding moving picture data every frame constructing the moving picture data, comprising:
a packet encoding unit which encodes each frame constructing a moving picture and outputs code amount information regarding the frame;
a target code amount setting unit which receives the current frame of the moving picture, calculates a prediction code amount regarding the current frame on the basis of it, receives a target bit rate and the code amount information regarding the preceding frame, and calculates a target code amount regarding the current frame on the basis of them; and
an encoding discriminating unit which determines whether the encoding of the current frame is executed or not on the basis of the target code amount and the prediction code amount.
According to the third aspect of the invention, there is provided a moving picture encoding apparatus for encoding moving picture data every frame constructing the moving picture data, comprising:
a packet encoding unit which encodes each frame constructing a moving picture and outputs code amount information regarding the frame;
a code amount predicting unit which receives the current frame of the moving picture and calculates a prediction code amount regarding the current frame on the basis of it;
a target code amount setting unit which receives a target bit rate and the code amount information regarding the preceding frame and calculates a target code amount regarding the current frame on the basis of them; and
an encoding discriminating unit which determines whether the encoding of the current frame is executed or not on the basis of the target code amount and the prediction code amount.
According to the fourth aspect of the invention, there is provided a moving picture encoding method of encoding moving picture data every frame constructing the moving picture data, comprising the steps of:
encoding each frame constructing a moving picture and outputting code amount information regarding the frame;
calculating a prediction code amount with respect to the frame of the moving picture;
calculating a target code amount on the basis of a target bit rate and the code amount information regarding the frame; and
determining whether the encoding of each frame of the moving picture is executed or not on the basis of the target code amount and the prediction code amount.
According to the fifth aspect of the invention, there is provided a moving picture encoding method of encoding moving picture data every frame constructing the moving picture data, comprising the steps of:
encoding each frame constructing a moving picture and outputting code amount information regarding the frame;
calculating a prediction code amount with respect to the current frame of the moving picture;
calculating a target code amount regarding the current frame on the basis of a target bit rate and the code amount information regarding the preceding frame; and
determining whether the encoding of the current frame is executed or not on the basis of the target code amount and the prediction code amount.
According to the sixth aspect of the invention, there is provided a moving picture encoding apparatus for encoding moving picture data every frame constructing the moving picture data, comprising:
a packet encoding unit which encodes each frame constructing a moving picture and outputs code amount information regarding the frame;
a target code amount setting unit which receives the frame of the moving picture, calculates a prediction code amount regarding the frame on the basis of it, receives a target bit rate and the code amount information regarding the frame, and calculates a target code amount regarding the frame on the basis of them; and
an encoding discriminating unit which determines whether the encoding of the frame is executed or not on the basis of the target code amount and the prediction code amount,
wherein when the received frame of the moving picture is an intra frame, the encoding discriminating unit encodes a predetermined area of this frame as a packet irrespective of the code amount information.
The above and other objects and features of the present invention will become apparent from the following detailed description and the appended claims with reference to the accompanying drawings.